<?php

/**
 * Description of Base
 *
 * @author a.novikov
 */
abstract class Object_Base extends SmartGetters {

	public static function fromProvider($provider, $type = null) {
		if (!$provider instanceof IObjectProvider) {
			throw new Exception('Intefrace IObjectProvider not implemented');
		}

		$element = $provider->getObject($type);
		if($element){
			if($provider instanceof ContentlistElementRow)
				$element->_object = $provider->parent_row;
			else
				$element->_object = $provider;
			return $element;
		} else return false;
	}
}